<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    .box{width: 200px;height: 100px;background: #eee;}
  </style>
</head>
<body>

  <div class="box"></div>

</body>
<script>

  var box = document.querySelector(".box")

  document.onkeydown = function( eve ){
    var e = eve || window.event;

    // 键码的兼容处理
    var code = e.keyCode || e.which;
    
    // box.innerHTML += code + "<br>";
    if( code === 13 && e.ctrlKey ){
      box.innerHTML += "同时按下了ctrl+回车键<br>";
    }

    // 功能键的单独判断方式
    // 功能键主要用来做组合键

    // // windows:ctrl, Mac:control
    // console.log(e.ctrlKey);
    // // windows:shift, Mac:↑
    // console.log(e.shiftKey);
    // // window:alt, Mac:option
    // console.log(e.altKey);
    // // windows:win(窗口), Mac:command
    // console.log(e.metaKey);
  }
  
</script>
</html>